home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_pcdp / ada / meex.ada < prev    next >
Text File  |  1996-01-30  |  962b  |  53 lines

  1. with Text_IO; use Text_IO;
  2. with Hardware_Primitives; use Hardware_Primitives;
  3. procedure MEEX is
  4.  
  5.   task T1;
  6.   task body T1 is
  7.     L: Integer := 0;
  8.   begin
  9.     loop
  10.       Put_Line("Task 1 is idling");
  11.       loop
  12.         Exchange(L);
  13.         exit when L = 0;
  14.       end loop;
  15.       Put_Line("Task 1 critical section");
  16.       Exchange(L);
  17.     end loop;
  18.   end T1;
  19.  
  20.   task T2;
  21.   task body T2 is
  22.     L: Integer := 0;
  23.   begin
  24.     loop
  25.       Put_Line("Task 2 is idling");
  26.       loop
  27.         Exchange(L);
  28.         exit when L = 0;
  29.       end loop;
  30.       Put_Line("Task 2 critical section");
  31.       Exchange(L);
  32.     end loop;
  33.   end T2;
  34.  
  35.   task T3;
  36.   task body T3 is
  37.     L: Integer := 0;
  38.   begin
  39.     loop
  40.       Put_Line("Task 3 is idling");
  41.       loop
  42.         Exchange(L);
  43.         exit when L = 0;
  44.       end loop;
  45.       Put_Line("Task 3 critical section");
  46.       Exchange(L);
  47.     end loop;
  48.   end T3;
  49.  
  50. begin
  51.   null;
  52. end MEEX;
  53.